<template>
  <div class="box">
    <!-- 标题栏 -->
    <van-nav-bar
      title="不凡"
      left-text="返回"
      left-arrow
      fixed
      @click-left="onClickLeft"
    />
    <div class="feedback-content">
        <div>意见与反馈</div>
        <!-- 留言 -->
        <van-field v-model="content" rows="4" autosize label="留言"
            type="textarea" maxlength="150" placeholder="请填写你的意见和反馈" show-word-limit/>
        <van-field v-model="phone" label="联系方式:" placeholder="邮箱/手机号/微信号" />
    </div>
    <div class="feedback-buttom">
        <div class="button" @click="feedbackClick">提交</div>
    </div>
  </div>
</template>
<script>
import { feedback } from "@/api/my/feedback.js";
export default {
  data() {
    return {
      content: "",
      name: "",
      openId: "",
      phone: "",
    };
  },
  methods:{
    getfeedback(){
     feedback({
        content:this.content,
        name:this.name,
        openId:localStorage.getItem('openId'),
        phone:this.phone
      }).then(res=>{
        console.log(res)
      })
    },
      //返回上一个页面
      onClickLeft(){
        this.$router.go(-1);
      },
      //提交页面
      feedbackClick(){
        this.getfeedback();
        this.content=this.phone=''
      }
  },
  created(){
    this.getfeedback();
  }
};
</script>
<style lang="scss" scoped>
.box{
    width: 100%;
    height: 600px;
    // height: calc(100% - 1Px);
    background-color: #f4f4f4;

    .feedback-content{
        margin-top: 48px;
        // background-color: #fff;  
        overflow: hidden;
        div{
            width: 100%;
            margin-top:5px;
            padding:5px 10px;
            background-color: #fff;
            font-size:14px;
        }
    }
    .feedback-buttom{
        width: 100%;
        height: 400px;
        background-color: #fff;
        overflow: hidden;
        margin-top:5px;
        .button{
            width: 90%;
            margin:50px auto;
            height: 50px;
            line-height: 50px;
            text-align: center;
            background-color: #b4282d;
            border-radius:5px;
            font-size: 16px;
            color: #fff;
        }
    }
}
</style>